package com.example.springboot_08_thymeleaf.mapper;

import com.example.springboot_08_thymeleaf.entity.Comment;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface commentMapper extends JpaRepository<Comment,Integer> {
    @Transactional//开启事务
    @Modifying //删除和修改操作必须添加此注解  idea兼容性差
    @Query(value = "insert into t_comment(content,author,a_id)  value (?1,?2,?3)",nativeQuery = true)
    int insertComment(String content,String author,Integer articleId);
}
